﻿using System;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YArchitech.HVAC
{
	[Transaction(TransactionMode.Manual)]
	[Regeneration(RegenerationOption.Manual)]
	public class cmdSelHide : IExternalCommand
	{
		public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
		{
			Result result;
			try
			{
				string text = RevitTools.hyGetCurrentSel(revit);
				CmdTools.cdGetCurrSel(revit, text).Attributes["Hide"].Value = "false";
				XmlInfo.hySaveXml();
				CmdTools.cdHide(revit, text, false);
				result = Autodesk.Revit.UI.Result.Succeeded;
			}
			catch
			{
				result = Autodesk.Revit.UI.Result.Failed;
			}
			return result;
		}
	}
}
